#########################
#   Author : Leon yu    #
#   Date : 2025/06/06   #
#   Id : SM2772         #
#########################
from datetime import datetime
from dbResps.businessOverview import *
from apiRespsAnalyze.businessOverviewResultFromApi import *
from compareResult.compareUtils import Compare

# 非当天 6/5号
startTime = 1717520400000
endTime = 1717606799000


getHistoryBusinessOverviewFromDB_Result = getHistoryBusinessOverviewFromDB(startTime, endTime)
dateFormatTemp1 = lambda x: datetime.strptime(str(dc.timestamp2Data(x)), "%Y/%m/%d %H:%M:%S").strftime("%Y/%m/%d")
bs = businessOverviewResult(startTime=startTime, endTime=endTime)
getBusinessOverviewFromApi_Result = {list(item.keys())[0]: list(item.values())[0] for item in bs[dateFormatTemp1(startTime)]}

if __name__ == "__main__":
    compareResult = Compare.compare(getHistoryBusinessOverviewFromDB_Result, getBusinessOverviewFromApi_Result)
    if compareResult:
        print('compare success')
    else:
        print('compare fail')